package com.example.memurbac_service.config;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @Author : gzj
 * @CreateTime : 2021/12/08
 * @Description :
 **/
@Configuration
public class ResourceConfig implements WebMvcConfigurer {

    public void addResourceHandlers(ResourceHandlerRegistry registry) {

        //图片存放路径
        String path = System.getProperty("user.dir") + "\\memurbac_service\\src\\main\\resources\\static\\images\\";


        //配置静态资源访问路径
        registry.addResourceHandler("/static/**").addResourceLocations("classpath:/static/");


        //配置静态资源映射
        registry.addResourceHandler("/images/**").addResourceLocations("file:"+path);
    }


}